home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-06-11 | 2.4 KB | 128 lines | [TEXT/PJMM] |
- unit Globals;
-
- interface
-
- uses
- PrintTraps, PicComments;
-
- const
- rMenuBar = 128;
-
- mApple = 128;
- iAbout = 1;
-
- mFile = 129;
- iPageSetup = 1;
- iPrint = 2;
- iQuit = 4;
-
- mEdit = 130;
-
- mSelect = 131;
- iNone = 0;
- iTextRotation = 1;
- iLineLayout = 2;
- iPolygon = 3;
- iDashedLine = 4;
- iLineWidth = 5;
- iGraphicsRot = 6;
- iPostScript = 7;
-
- rWindowID = 128; { our main window }
- rAboutAlert = 128; { About ... }
- rPolyOptions = 129; { modal dlg window }
- iFilled = 3;
- iClosed = 4;
- iUser = 6;
- rTxtPicOptions = 130; { tJus, tFlip fields }
- iJNone = 3;
- iJLeft = 4;
- iJCenter = 5;
- iJRight = 6;
- iJFull = 7;
- iFNone = 8;
- iFHoriz = 9;
- iFVertic = 10;
- iOKUser = 13;
-
- rStrings = 128; { list of strings }
- iSuggestSelection = 1;
- iRotatedText = 2; { used in unit "TestPicComments" }
- iLineLayout1 = 3;
- iLineLayout2 = 4;
- iCommentRotate = 5; { tell them we don't rotate QuickDraw text (yet) }
-
- rFontNames = 129;
- iTextRotFont = 1;
- iLLFont1 = 2;
- iLLFont2 = 3;
-
- var
- gDone: Boolean;
- gWP: WindowPtr; { our only window }
- gWhichDemo: iNone..iPostScript;
- gPrRec: THPrint; { global print record }
- gPrPort: TPPrPort; { non-relocatable printing port }
- gJus, gFlip: Integer; { for text rotation }
- gFilled, gClosed: Boolean; { for Polygon picture comments }
-
- procedure InitMac; { Always the same }
- procedure InitApp; { Initialize my globals, and set up environment }
-
-
- implementation
-
- procedure InitMac;
- begin
- InitGraf(@thePort);
- InitFonts;
- FlushEvents(everyEvent, 0);
- InitWindows;
- InitMenus;
- TEInit;
- InitDialogs(nil);
- InitCursor;
- end;
-
-
- procedure InitApp;
- var
- i: Integer;
- ignore: Boolean;
- menuBar: Handle;
- evt: EventRecord;
- begin
- gDone := FALSE;
- gJus := tJusNone;
- gFlip := tFlipNone;
- gFilled := FALSE;
- gClosed := FALSE;
- gWhichDemo := iNone;
- gWP := GetNewWindow(rWindowID, nil, WindowPtr(-1));
- if gWP = nil then
- DebugStr('GetNewWindow failed');
- SetPort(gWP);
-
- gPrPort := TPPrPort(NewPtr(SizeOf(TPrPort)));
- if gPrPort = nil then
- DebugStr('NewPtr(TPrPort) failed');
-
- gPrRec := THPrint(NewHandle(SizeOf(TPrint)));
- if gPrRec = nil then
- DebugStr('NewHandle(PrintRecord) failed');
- PrintDefault(gPrRec);
-
- menuBar := GetNewMBar(rMenuBar);
- if menuBar = nil then
- DebugStr('GetNewMBar failed');
-
- SetMenuBar(menuBar);
- DisposHandle(menuBar);
- AddResMenu(GetMHandle(mApple), 'DRVR');
- DrawMenuBar;
- for i := 1 to 3 do
- ignore := EventAvail(everyEvent, evt);
- end;
-
-
- end.